package com.hrl.dao;

import com.hrl.domain.Employee;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;


public interface EmpDao {
    @Select("select * from tb_emp")
    public List<Employee> findAll();

    @Select("select * from tb_emp where emp_id = #{id}")
    public Employee findById(Integer emp_id);

    @Update("Insert into tb_emp values(null,#{emp_name},#{dept_id},#{job_name},#{join_date},#{telephone})")
    public void save(Employee employee);

    @Update("update tb_emp set emp_name=#{emp_name},dept_id=#{dept_id},job_name=#{job_name},join_date=#{join_date},telephone=#{telephone} where emp_id=#{emp_id}")
    public void update (Employee employee);

    @Delete("delete from tb_emp where emp_id=#{emp_id}")
    public void delete(Integer emp_id);

}
